feat(cli): support opt-in bundleDependencies in zero-yaml compile#6706
Closed
sahilnyk wants to merge 5 commits into
Closed
feat(cli): support opt-in bundleDependencies in zero-yaml compile#6706sahilnyk wants to merge 5 commits into
sahilnyk wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 5 files
Confidence score: 2/5
- In
packages/cli/lib/zeroYaml/compile.ts, allowingbundleDependenciesto include Node built-ins appears to bypass the sandbox import policy, which could let restricted modules be imported at runtime and weaken isolation/security guarantees if merged as-is — validatebundleDependenciesas true package deps (and explicitly reject Node built-ins) before merging.
Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.
Re-trigger cubic
sahilnyk
force-pushed
the
feat/compile-bundle-dependencies
branch
from
July 15, 2026 18:29
5f6c37e to
85d0e80
Compare
Signed-off-by: sahilnyk <contactsahilpnayak@gmail.com>
sahilnyk
force-pushed
the
feat/compile-bundle-dependencies
branch
from
July 15, 2026 19:36
d9d6307 to
bd8b65d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Thanks to @diegoleme for reporting this in #6425 and proposing the
bundleDependenciesapproach.In a monorepo, a sync often needs to reuse an internal workspace package (like
@repo/sharedfor helpers or types). Right nownango compilewon't allow it. From the issue:Two things cause it:
external, so@repo/sharednever gets bundled and is missing in the sandbox.disallowed_importfor anything outside the hardcoded allowlist.Solution
Add an opt-in
bundleDependenciesarray to the project'spackage.json:{ "bundleDependencies": ["@repo/shared"] }Packages in that list skip the disallowed_import check and get inlined into the compiled .cjs instead of externalized. Subpaths like @repo/shared/utils match too. Safe for the sandbox
since the code is inlined at build time, and nothing changes when the field is absent.
Node built-ins are rejected. Under platform: 'node' esbuild leaves built-ins external, so listing something like "fs" would let a script reach the sandbox and skip the allowlist. They're
blocked both when the config is read and if one reaches esbuild resolution.
Closes #6425
Testing
Run:
npx vitest --config ./vite.cli.config.ts run6 tests, all run locally and passing:
Note: config shape/naming mirrors the issue's proposal. Happy to adjust, and I left docs out until it's confirmed.